#pragma once

#include "math.h"

class IConvexDomain2;

/** @file 
 *  high level entry functions of all the collision handling.
 *  @todo implement dispatch system after implement other CD algorithm.
 */
/// collision detection
bool doIntersect(const IConvexDomain2& domainA, const Vector2& positionA,
				 const IConvexDomain2& domainB, const Vector2& positionB,
				 Scalar boundaryTolerance
				 /*, ICollisionDispatcher& dispatcher */);

/// detect collision and find contact point
bool findContactPoint(const IConvexDomain2& domainA, const Vector2& positionA,
					  const IConvexDomain2& domainB, const Vector2& positionB,
					  Scalar boundaryTolerance,
					  Vector2& contactPointA,
					  Vector2& contactPointB,
					  Vector2& contactNormal,
					  Scalar&  penetrationDistance);

/// dynamic collision detection
bool computeTimeOfImpact(
				const IConvexDomain2& domainA, const Vector2& pA0, const Vector2& pA1, 
				const IConvexDomain2& domainB, const Vector2& pB0, const Vector2& pB1,
				Scalar boundaryTolerance,
				Vector2& contactPointA,
				Vector2& contactPointB,
				Vector2& contactNormal,
				Scalar& lambda);
